Skip to main content

Integration Examples

Outter’s Recommendations API delivers personalized recommendations across different domains. Typical use cases include:

  • E-commerce – Suggesting related products or add-ons based on a user’s browsing or purchase history.
  • Ticketing – Recommending events or seat upgrades based on past event attendance or preferences.
  • EdTech – Recommending courses or learning materials tailored to a student’s profile and progress.

Regardless of the scenario, the API usage is similar. You send context (such as user ID, current item, or other relevant info) to the recommendations endpoint, and you receive a list of recommended items in response. For example, an e-commerce app might call POST /api/v2/ai/recommendations with a user and current product, and get back a JSON array of recommended product IDs or objects.

Node.js (React)

Using fetch to retrieve recommendations in a web or Node environment.

const payload = {
userId: "user_123",
currentItemId: "prod_456",
numRecommendations: 5
};

fetch("<https://api.outter.ai/v2/ai/recommendations>", {
method: "POST",
headers: {
"Authorization": "X-API-Key YOUR_API_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify(payload)
})
.then(res => res.json())
.then(data => {
console.log("Recommended items:", data);
// e.g., data might be an array of recommended product IDs or objects
});

Laravel (PHP)

Using Laravel’s HTTP client to get product recommendations for a user.

use Illuminate\\Support\\Facades\\Http;

$data = [
'userId' => 'user_123',
'currentItemId' => 'prod_456',
'numRecommendations' => 5
];

$response = Http::withHeaders([
'Authorization' => 'X-API-Key YOUR_API_KEY',
])->post('<https://api.outter.ai/v2/ai/recommendations>', $data);

if ($response->successful()) {
$recommendations = $response->json();
// Handle the recommended items (e.g., $recommendations is an array of products)
} else {
// Handle error (log $response->body() or take action)
}

.NET (C#) Example

Using HttpClient to call the Recommendations API.

using System.Net.Http;
using System.Text;
using System.Text.Json;

// ... inside an async context/method:
var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "X-API-Key YOUR_API_KEY");

var requestObj = new {
userId = "user_123",
currentItemId = "prod_456",
numRecommendations = 5
};
string json = JsonSerializer.Serialize(requestObj);
var content = new StringContent(json, Encoding.UTF8, "application/json");

HttpResponseMessage response = await client.PostAsync("<https://api.outter.ai/v2/ai/recommendations>", content);
if (response.IsSuccessStatusCode) {
string responseBody = await response.Content.ReadAsStringAsync();
// Parse the JSON (e.g., using JsonDocument or similar) to get recommended items
Console.WriteLine("Recommendations: " + responseBody);
} else {
string error = await response.Content.ReadAsStringAsync();
Console.WriteLine("Error: " + error);
}